package com.owc.controller.admin;

import com.owc.domain.BaseResult;
import com.owc.domain.PageVo;
import com.owc.domain.dto.admin.RechargeDetail;
import com.owc.domain.dto.admin.RechargeListDTO;
import com.owc.domain.entity.RechargeFlow;
import com.owc.domain.vo.admin.RechargeQueryVo;
import com.owc.service.RechargeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * @Author Jackies
 * @Date 2019/12/16 21:32
 * @Description TODO://
 **/
@RestController
@RequestMapping(value = "/admin/recharge/")
public class RechargeController {

    @Autowired
    private RechargeService rechargeService;

    @PostMapping(value = "list")
    public BaseResult<List<RechargeListDTO>> list(@RequestBody @Valid RechargeQueryVo rechargeQueryVo){
        return rechargeService.list(rechargeQueryVo);
    }

    @PostMapping(value = "/detail")
    public BaseResult<RechargeDetail> detail(@RequestBody RechargeQueryVo rechargeQueryVo){
        Assert.notNull(rechargeQueryVo.getId(),"订单ID不能为空");
        return BaseResult.success(rechargeService.detail(rechargeQueryVo.getId()));
    }

}
